package hashprogramm;
import java.io.FileReader;
import java.util.Map;
import java.util.Scanner;
import hashprogramm.HashMap_2;
import hashprogramm.MurmurHash2;

public class HashProgramm 
{
    public static void main(String[] args) 
    {
        try
        {
            int i = 0;
            String st = new String();
            Scanner s = new Scanner(new FileReader("война и мир.txt"));
            HashMap_2<String, Integer> h = new HashMap_2<String, Integer>();
            while(s.hasNext())  
            {
                st = s.next();
                if(!h.containsKey(st))      h.put(st, 1);
                else        h.put(st, h.get(st) + 1);
            }  
            for (Map.Entry<String, Integer> entry: h.entrySet())
                System.out.println(entry.getKey() + " " + entry.getValue());
        }
        catch(java.io.IOException e)    
        { 
            e.printStackTrace(); 
        }
    }
}
